home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_commie_grid.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  373 lines

  1.  
  2. # Jones 3D Cog Script
  3. #
  4. # OLV_Commie_Grid.cog
  5. # Cog to control the AI and patrol behavior of the commies in the Olmec Valley
  6. #
  7. # [JM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15. # ========================================================================================
  16.  
  17. message         startup
  18. message         crossed
  19. message         entered
  20. message         user0
  21.  
  22. # ========================== SUBROUTINES ===========================
  23.  
  24. flex            MakeGrid            local
  25. flex            CommiesEnter        local
  26. flex            EnableAI            local
  27. flex            DisableAI           local
  28. flex            HuntPlayer          local
  29.  
  30. # ======================= MISC LOCAL VARIABLES ===================
  31.  
  32. int             counter             local
  33. int             counter2            local
  34. int             StartCheck=0        local
  35. int             check=0             local
  36. int             ActivateGrid=0      local
  37.  
  38. AI              AI_Sniper=com_2Hsniper.ai   local
  39.  
  40. # ========================= CONSTANTS =================================
  41.  
  42. int             NUMBER_OF_WPNTS=44                  local
  43. int             CLEAR_WPNTS_TOTAL=60                local
  44.  
  45. int             INITIAL_DISABLED_COMMIES=11         local
  46. int             NUMBER_OF_SNIPERS=3                 local
  47. int             NUMBER_OF_HUNTERS=3                 local
  48. int             HUNTERS_TO_BE_TELEPORTED=2          local
  49. int             NUMBER_OF_ROAMERS=1                 local
  50. int             NUMBER_OF_SLACKERS=6                local
  51.  
  52. # ====================== WORLD GEOMETRY REFERENCES ==========================
  53.  
  54. surface         CommieGridOff1          LinkID=1
  55.  
  56. surface         CommieGridOn1           LinkID=2
  57.  
  58. sector          HuntTrigger00           LinkID=3
  59. sector          HuntTrigger01           LinkID=3
  60.  
  61. # ========================== COMMIES ================================
  62.  
  63. thing           Hunter00                local   #These two commies are acquired through the olv_commie_intro.cog... no references needed
  64. thing           Hunter01                local
  65. thing           Hunter02                
  66.  
  67. thing           Roamer00                
  68. #thing           Roamer01                
  69. #thing           Roamer02
  70.  
  71. thing           Sniper00                
  72. thing           Sniper01      
  73. thing           Sniper02          
  74.  
  75. thing           Slacker00               
  76. thing           Slacker01               
  77. thing           Slacker02               
  78. thing           Slacker03               
  79. thing           Slacker04               
  80. thing           Slacker05               
  81. #thing           Slacker06               
  82.  
  83. thing           Teleporter0             
  84. thing           Teleporter1             
  85. # ============================= COGS ===============================
  86.  
  87. cog             OLV_Jag1
  88. cog             OLV_Jag2
  89. cog             OLV_Jag_Temple
  90.                                                              
  91. # ========================== WAYPOINTS ==============================
  92.  
  93. thing           TempWpnt                
  94.  
  95. thing           wpnt00
  96. thing           wpnt01
  97. thing           wpnt02
  98. thing           wpnt03
  99. thing           wpnt04
  100. thing           wpnt05
  101. thing           wpnt06
  102. thing           wpnt07
  103. thing           wpnt08
  104. thing           wpnt09
  105. thing           wpnt10
  106. thing           wpnt11
  107. thing           wpnt12
  108. thing           wpnt13
  109. thing           wpnt14
  110. thing           wpnt15
  111. thing           wpnt16
  112. thing           wpnt17
  113. thing           wpnt18
  114. thing           wpnt19
  115. thing           wpnt20
  116. thing           wpnt21
  117. thing           wpnt22
  118. thing           wpnt23
  119. thing           wpnt24
  120. thing           wpnt25
  121. thing           wpnt26
  122. thing           wpnt27
  123. thing           wpnt28
  124. thing           wpnt29
  125. thing           wpnt30
  126. thing           wpnt31
  127. thing           wpnt32
  128. thing           wpnt33
  129. thing           wpnt34
  130. thing           wpnt35
  131. thing           wpnt36
  132. thing           wpnt37
  133. thing           wpnt38
  134. thing           wpnt39
  135. thing           wpnt40
  136.  
  137. thing           wpnt41
  138. thing           wpnt42
  139. thing           wpnt43
  140.  
  141. #the above three waypoints are over by the whipswing after the second bridge
  142.  
  143. end
  144.  
  145. # =================================================================================
  146. # =================================== CODE ========================================
  147. # =================================================================================
  148. code
  149. # =================================================================================
  150. startup:
  151.     
  152.     for(counter = 0; counter < INITIAL_DISABLED_COMMIES; counter = counter + 1)
  153.     {
  154.         SetThingFlags(Hunter02[counter], 0x80000);
  155.     }
  156.     
  157.     return;
  158.     
  159.     
  160. # =======================================================================================
  161. user0:
  162.     
  163.     ActivateGrid = GetParam(2); 
  164.     
  165.     if(ActivateGrid == 1)
  166.     {
  167.         Hunter00 = Getparam(0);
  168.         CaptureThing(Hunter00);
  169.         
  170.         Hunter01 = GetParam(1);
  171.         CaptureThing(Hunter01);
  172.     }
  173.     
  174.     SendMessageEx(OLV_Jag1, 27, 0, 0, 0, 0);
  175.     SendMessageEx(OLV_Jag2, 27, 0, 0, 0, 0);    
  176.     SendMessageEx(OLV_Jag_Temple, 27, 0, 0, 0, 0);
  177.     
  178.     StartCheck = 1;
  179.     
  180.     Call     MakeGrid;
  181.     Call     CommiesEnter;
  182.     Call     EnableAI;
  183.              
  184.     return;
  185.     
  186. # ============================================================================
  187. crossed:
  188.  
  189.     if(GetSenderID() == 1)
  190.     {
  191.         Call DisableAI;   
  192.     }
  193.     
  194.     if(GetSenderID() == 2)
  195.     {   
  196.         Call MakeGrid;
  197.         Call EnableAI;
  198.     }
  199.  
  200.     return;
  201.    
  202. # ========================================================================================
  203. entered:
  204.     
  205.     if(StartCheck != 1) return;
  206.     if(check == 1)  return;
  207.     if(GetSenderID() != 3) return;
  208.     
  209.     check = 1;
  210.     
  211.     call HuntPlayer;
  212.     
  213.     return;    
  214.     
  215. # ========================================================================================
  216. MakeGrid:
  217.     
  218.     for(counter = 0; counter < CLEAR_WPNTS_TOTAL; counter = counter + 1)
  219.     {
  220.         AISetWpnt(TempWpnt, counter);  //Clearing any waypoints that already exist
  221.     }
  222.     
  223.     for(counter = 0; counter < NUMBER_OF_WPNTS; counter = counter + 1)
  224.     {
  225.         AISetWpnt(wpnt00[counter], counter);    //Assign the ghost objects to the waypoint slots
  226.     }
  227.  
  228.     AIConnectWpnts(0, 1);
  229.     AIConnectWpnts(0, 2);
  230.     AIConnectWpnts(1, 3);
  231.     AIConnectWpnts(1, 4);
  232.     AIConnectWpnts(2, 5);
  233.     AIConnectWpnts(3, 4);
  234.     AIConnectWpnts(3, 5);
  235.     AIConnectWpnts(4, 6);
  236.     AIConnectWpnts(5, 6);
  237.     AIConnectWpnts(5, 7);
  238.     AIConnectWpnts(7, 8);
  239.     AIConnectWpnts(8, 9);
  240.     AIConnectWpnts(9, 10);
  241.     AIConnectWpnts(9, 11);
  242.     AIConnectWpnts(10, 11);
  243.     AIConnectWpnts(10, 13);
  244.     AIConnectWpnts(11, 12);
  245.     AIConnectWpnts(11, 13);
  246.     AIConnectWpnts(11, 14);
  247.     AIConnectWpnts(13, 15);
  248.     AIConnectWpnts(14, 15);
  249.     AIConnectWpnts(14, 16);
  250.     AIConnectWpnts(15, 16);
  251.     AIConnectWpnts(16, 17);
  252.     AIConnectWpnts(17, 18);
  253.     AIConnectWpnts(18, 19);
  254.     AIConnectWpnts(18, 22);
  255.     AIConnectWpnts(19, 20);
  256.     AIConnectWpnts(19, 21);
  257.     AIConnectWpnts(20, 21);
  258.     AIConnectWpnts(21, 23);
  259.     AIConnectWpnts(21, 22);
  260.     AIConnectWpnts(22, 24);
  261.     AIConnectWpnts(23, 25);
  262.     AIConnectWpnts(24, 25);
  263.     AIConnectWpnts(25, 26);
  264.     AIConnectWpnts(26, 27);
  265.     AIConnectWpnts(27, 28);
  266.     AIConnectWpnts(28, 29);
  267.     AIConnectWpnts(29, 30);
  268.     
  269.     AIConnectWpnts(12, 32);
  270.     AIConnectWpnts(32, 33);
  271.     AIConnectWpnts(33, 34);
  272.     AIConnectWpnts(34, 35);
  273.     AIConnectWpnts(35, 36);
  274.     AIConnectWpnts(36, 37);
  275.     AIConnectWpnts(37, 38);
  276.     AIConnectWpnts(37, 39);
  277.     AIConnectWpnts(39, 40);
  278.     
  279.     AIConnectWpnts(41, 42);
  280.     
  281.     return;
  282.     
  283. # =================================================================================
  284. //Starts and sets all of the various instincts for the commies.  
  285. CommiesEnter:
  286.         
  287.         for(counter = 0; counter < NUMBER_OF_HUNTERS; counter = counter + 1)
  288.         {
  289.             ClearThingFlags(Hunter00[counter], 0x80000);
  290.         }
  291.         
  292.         for(counter = 0; counter < NUMBER_OF_ROAMERS; counter = counter + 1)
  293.         {
  294.             ClearThingFlags(Roamer00[counter], 0x80000);
  295.         }
  296.         
  297.         for(counter = 0; counter < NUMBER_OF_SNIPERS; counter = counter + 1)
  298.         {
  299.             ClearThingFlags(Sniper00[counter], 0x80000);
  300.             AISetClass(Sniper00[counter], AI_sniper);
  301.         }
  302.         
  303.         for(counter = 0; counter < NUMBER_OF_SLACKERS; counter = counter + 1)
  304.         {
  305.             ClearThingFlags(Slacker00[counter], 0x80000);
  306.         }
  307.  
  308.     return;
  309.     
  310. # ================================================================================
  311. EnableAI:
  312.  
  313.         for(counter = 0; counter < NUMBER_OF_HUNTERS; counter = counter + 1)
  314.         {
  315.             AISetInstinctWpntMode(Hunter00[counter]);
  316.             AIEnableInstinct(Hunter00[counter], "roam", 1);
  317.         }
  318.         
  319.         for(counter = 0; counter < NUMBER_OF_ROAMERS; counter = counter + 1)
  320.         {
  321.             AIEnableInstinct(Roamer00[counter], "roam", 1);
  322.             AISetInstinctWpntMode(Roamer00[counter]);
  323.         }         
  324.                 
  325.         for(counter = 0; counter < NUMBER_OF_SLACKERS; counter = counter + 1)
  326.         {        
  327.             AISetInstinctWpntMode(Slacker00[counter]);
  328.         }    
  329.  
  330.     return;
  331.  
  332. # ====================================================================================
  333. DisableAI:
  334.         
  335.         for(counter = 0; counter < NUMBER_OF_HUNTERS; counter = counter + 1)
  336.         {
  337.             AIClearInstinctWpntMode(Hunter00[counter]);
  338.             AIEnableInstinct(Hunter00[counter], "roam", 0);
  339.         }
  340.         
  341.         for(counter = 0; counter < NUMBER_OF_ROAMERS; counter = counter + 1)
  342.         {
  343.             AIEnableInstinct(Roamer00[counter], "roam", 0);
  344.             AIClearInstinctWpntMode(Roamer00[counter]);
  345.         }         
  346.                 
  347.         for(counter = 0; counter < NUMBER_OF_SLACKERS; counter = counter + 1)
  348.         {        
  349.             AIClearInstinctWpntMode(Slacker00[counter]);
  350.         }
  351.  
  352.     return;
  353.  
  354. # ========================================================================================
  355. HuntPlayer:
  356.     
  357.     for(counter = 0; counter < NUMBER_OF_HUNTERS; counter = counter + 1)
  358.     {   
  359.         if(counter < HUNTERS_TO_BE_TELEPORTED)
  360.         {
  361.             TeleportThing(Hunter00[counter], Teleporter0[counter]);
  362.         }
  363.         AIWpntHuntTarget(Hunter00[counter], 2.5, 0.0);
  364.     }
  365.            
  366.     return;
  367.  
  368. # ========================================================================================
  369. end
  370. # ========================================================================================
  371.